{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/pages/Home/Profile/index.tsx\",\n  _s = $RefreshSig$();\nimport React from 'react';\nimport { Home } from \"../../\";\nimport { Circle } from 'rc-progress';\nimport { observer } from \"mobx-react-lite\";\nimport { Context } from \"../../../index\";\nimport { profileCompletionPercentage } from \"../../../utils/User\";\nimport Switch from '@mui/material/Switch';\nimport { Button, UserProfile, Modal, Error } from '../../../components';\nimport { ChangeProfileForm } from '../../../modules/';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst Profile = () => {\n  _s();\n  const {\n    store\n  } = React.useContext(Context);\n  const [profilePercent, setProfilePercent] = React.useState(0);\n  const [disableToggle, setDisableToggle] = React.useState(true);\n  const [showModal, setShowModal] = React.useState(false);\n  const [showUserEdit, setShowUserEdit] = React.useState(false);\n  const [profile, setProfile] = React.useState(store.getProfile());\n  const memoizedProfile = React.useMemo(() => profileCompletionPercentage(store.getProfile()),\n  // eslint-disable-next-line react-hooks/exhaustive-deps\n  [store.profile]);\n  React.useEffect(() => {\n    setProfilePercent(memoizedProfile);\n    setProfile(store.getProfile());\n    console.log(\"test\", 4);\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [store.profile]);\n  return /*#__PURE__*/_jsxDEV(Home, {\n    childrenFirst: /*#__PURE__*/_jsxDEV(\"div\", {\n      className: \"messenger__sidebar-item\",\n      children: [/*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"messenger__sidebar-item-header\",\n        children: /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"messenger__sidebar-item-header-top\",\n          children: /*#__PURE__*/_jsxDEV(\"span\", {\n            children: \"\\u041D\\u0430\\u0441\\u0442\\u0440\\u043E\\u0439\\u043A\\u0438 \\u043F\\u0440\\u043E\\u0444\\u0438\\u043B\\u044F\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 39,\n            columnNumber: 29\n          }, this)\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 38,\n          columnNumber: 25\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 37,\n        columnNumber: 21\n      }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"messenger__sidebar-profile\",\n        children: [/*#__PURE__*/_jsxDEV(Circle, {\n          percent: profilePercent,\n          strokeWidth: 3,\n          className: \"messenger__sidebar-profile-progress\"\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 43,\n          columnNumber: 25\n        }, this), /*#__PURE__*/_jsxDEV(\"p\", {\n          className: \"messenger__sidebar-profile-progressInfo\",\n          children: [\"\\u041F\\u0440\\u043E\\u0444\\u0438\\u043B\\u044C \\u0437\\u0430\\u043F\\u043E\\u043B\\u043D\\u0435\\u043D \\u043D\\u0430: \", profilePercent.toString().slice(0, 5), \"%\"]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 48,\n          columnNumber: 25\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 42,\n        columnNumber: 21\n      }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"messenger__sidebar-profileControl\",\n        children: [/*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"messenger__sidebar-profileControl-top\",\n          children: [/*#__PURE__*/_jsxDEV(Switch, {\n            checked: !disableToggle,\n            onChange: () => setDisableToggle(!disableToggle),\n            name: \"special\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 54,\n            columnNumber: 29\n          }, this), /*#__PURE__*/_jsxDEV(\"span\", {\n            className: \"messenger__sidebar-profileControl-top-toggleInfo\",\n            children: \"\\u0421\\u043F\\u0435\\u0446\\u0438\\u0430\\u043B\\u044C\\u043D\\u044B\\u0435 \\u0432\\u043E\\u0437\\u043C\\u043E\\u0436\\u043D\\u043E\\u0441\\u0442\\u0438\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 59,\n            columnNumber: 29\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 53,\n          columnNumber: 25\n        }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"messenger__sidebar-profileControl-main\",\n          children: [/*#__PURE__*/_jsxDEV(Button, {\n            customClassName: \"messenger__sidebar-profileControl-changeProfile\",\n            fullWidth: false,\n            text: !disableToggle ? 'Изменить профиль' : '',\n            disable: disableToggle,\n            callback: () => setShowUserEdit(!showUserEdit)\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 64,\n            columnNumber: 29\n          }, this), /*#__PURE__*/_jsxDEV(Button, {\n            customClassName: \"messenger__sidebar-profileControl-deleteProfile\",\n            fullWidth: false,\n            text: !disableToggle ? 'Удалить профиль' : '',\n            disable: disableToggle,\n            callback: () => setShowModal(!showModal)\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 71,\n            columnNumber: 29\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 63,\n          columnNumber: 25\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 52,\n        columnNumber: 21\n      }, this), /*#__PURE__*/_jsxDEV(Modal, {\n        active: showModal,\n        title: \"Удаление профиля\",\n        hasFunctionButtons: true,\n        onSubmit: () => store.deleteProfileFromAPI(),\n        onClose: () => setShowModal(false),\n        customClassNameButtonSecond: \"messenger__sidebar-profileControl-deleteProfile\",\n        children: /*#__PURE__*/_jsxDEV(\"div\", {\n          children: \"\\u0412\\u044B \\u0434\\u0435\\u0439\\u0441\\u0442\\u0432\\u0438\\u0442\\u0435\\u043B\\u044C\\u043D\\u043E \\u0445\\u043E\\u0442\\u0438\\u0442\\u0435 \\u0431\\u0435\\u0437\\u0432\\u043E\\u0437\\u0432\\u0440\\u0430\\u0442\\u043D\\u043E \\u0443\\u0434\\u0430\\u043B\\u0438\\u0442\\u044C \\u043F\\u0440\\u043E\\u0444\\u0438\\u043B\\u044C?\"\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 88,\n          columnNumber: 25\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 80,\n        columnNumber: 21\n      }, this), /*#__PURE__*/_jsxDEV(Error, {\n        text: 'Пользователь с таким псевдонимом уже существует!'\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 90,\n        columnNumber: 21\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 36,\n      columnNumber: 17\n    }, this),\n    childrenSecond: !showUserEdit && /*#__PURE__*/_jsxDEV(\"div\", {\n      className: \"messenger__imProfile\",\n      children: profile.id && /*#__PURE__*/_jsxDEV(UserProfile, {\n        profile: profile\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 96,\n        columnNumber: 40\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 95,\n      columnNumber: 21\n    }, this) || /*#__PURE__*/_jsxDEV(\"div\", {\n      className: \"messenger__imProfile\",\n      children: profile.id && /*#__PURE__*/_jsxDEV(ChangeProfileForm, {\n        cancel: () => setShowUserEdit(false),\n        profile: profile\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 99,\n        columnNumber: 36\n      }, this)\n    }, void 0, false, {\n      fileName: _jsxFileName,\n      lineNumber: 98,\n      columnNumber: 17\n    }, this)\n  }, void 0, false, {\n    fileName: _jsxFileName,\n    lineNumber: 34,\n    columnNumber: 9\n  }, this);\n};\n_s(Profile, \"LVL7lzvztfJMAmiFfVY9Wwr1d2E=\");\n_c = Profile;\nexport default _c2 = observer(Profile);\nvar _c, _c2;\n$RefreshReg$(_c, \"Profile\");\n$RefreshReg$(_c2, \"%default%\");","map":{"version":3,"names":["React","Home","Circle","observer","Context","profileCompletionPercentage","Switch","Button","UserProfile","Modal","Error","ChangeProfileForm","Profile","store","useContext","profilePercent","setProfilePercent","useState","disableToggle","setDisableToggle","showModal","setShowModal","showUserEdit","setShowUserEdit","profile","setProfile","getProfile","memoizedProfile","useMemo","useEffect","console","log","toString","slice","deleteProfileFromAPI","id"],"sources":["/data/messenger.client/src/pages/Home/Profile/index.tsx"],"sourcesContent":["import React from 'react';\nimport {Home} from \"../../\";\nimport  {Circle} from 'rc-progress';\nimport {observer} from \"mobx-react-lite\";\nimport {Context} from \"../../../index\";\nimport {profileCompletionPercentage} from \"../../../utils/User\";\nimport Switch from '@mui/material/Switch';\nimport {Button, UserProfile, Modal, Error} from '../../../components'\nimport {ChangeProfileForm} from '../../../modules/';\nimport {UserListItem} from \"../../../models/response/UserListItem\";\n\nconst Profile = () => {\n    const {store} = React.useContext(Context);\n    const [profilePercent, setProfilePercent] = React.useState<number>(0);\n    const [disableToggle, setDisableToggle] = React.useState<boolean>(true);\n    const [showModal, setShowModal] = React.useState<boolean>(false);\n    const [showUserEdit, setShowUserEdit] = React.useState<boolean>(false);\n    const [profile, setProfile] = React.useState<UserListItem>(store.getProfile());\n\n    const memoizedProfile = React.useMemo(\n        () => profileCompletionPercentage(store.getProfile()),\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n        [store.profile]\n    );\n\n    React.useEffect(() => {\n        setProfilePercent(memoizedProfile);\n        setProfile(store.getProfile());\n        console.log(\"test\", 4)\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n    },[store.profile]);\n\n    return (\n        <Home\n            childrenFirst={\n                <div className=\"messenger__sidebar-item\">\n                    <div className=\"messenger__sidebar-item-header\">\n                        <div className=\"messenger__sidebar-item-header-top\">\n                            <span>Настройки профиля</span>\n                        </div>\n                    </div>\n                    <div className=\"messenger__sidebar-profile\">\n                        <Circle\n                            percent={profilePercent}\n                            strokeWidth={3}\n                            className=\"messenger__sidebar-profile-progress\"\n                        />\n                        <p className=\"messenger__sidebar-profile-progressInfo\">\n                            Профиль заполнен на: {profilePercent.toString().slice(0, 5)}%\n                        </p>\n                    </div>\n                    <div className=\"messenger__sidebar-profileControl\">\n                        <div className=\"messenger__sidebar-profileControl-top\">\n                            <Switch\n                                checked={!disableToggle}\n                                onChange={() => setDisableToggle(!disableToggle)}\n                                name=\"special\"\n                            />\n                            <span className=\"messenger__sidebar-profileControl-top-toggleInfo\">\n                                Специальные возможности\n                            </span>\n                        </div>\n                        <div className=\"messenger__sidebar-profileControl-main\">\n                            <Button\n                                customClassName=\"messenger__sidebar-profileControl-changeProfile\"\n                                fullWidth={false}\n                                text={!disableToggle?'Изменить профиль':''}\n                                disable={disableToggle}\n                                callback={() => setShowUserEdit(!showUserEdit)}\n                            />\n                            <Button\n                                customClassName=\"messenger__sidebar-profileControl-deleteProfile\"\n                                fullWidth={false}\n                                text={!disableToggle?'Удалить профиль':''}\n                                disable={disableToggle}\n                                callback={() => setShowModal(!showModal)}\n                            />\n                        </div>\n                    </div>\n                    <Modal\n                        active={showModal}\n                        title={\"Удаление профиля\"}\n                        hasFunctionButtons={true}\n                        onSubmit={() => store.deleteProfileFromAPI()}\n                        onClose={() => setShowModal(false)}\n                        customClassNameButtonSecond={\"messenger__sidebar-profileControl-deleteProfile\"}\n                    >\n                        <div>Вы действительно хотите безвозвратно удалить профиль?</div>\n                    </Modal>\n                    <Error text={'Пользователь с таким псевдонимом уже существует!'} />\n                </div>\n            }\n            childrenSecond={\n                (!showUserEdit &&\n                    <div className=\"messenger__imProfile\">\n                        {profile.id && <UserProfile profile={profile} />}\n                    </div>) ||\n                <div className=\"messenger__imProfile\">\n                    {profile.id && <ChangeProfileForm\n                        cancel={() => setShowUserEdit(false)}\n                        profile={profile}\n                    />}\n                </div>\n            }\n        />\n    );\n}\n\nexport default observer(Profile);"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAQC,IAAI,QAAO,QAAQ;AAC3B,SAASC,MAAM,QAAO,aAAa;AACnC,SAAQC,QAAQ,QAAO,iBAAiB;AACxC,SAAQC,OAAO,QAAO,gBAAgB;AACtC,SAAQC,2BAA2B,QAAO,qBAAqB;AAC/D,OAAOC,MAAM,MAAM,sBAAsB;AACzC,SAAQC,MAAM,EAAEC,WAAW,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